<template>
	<view class="news_item">

		<view class="newsTitle">
			{{notices_info.title}}
		</view>
		<view class="info">
			<text>浏览：{{notices_info.heat}}</text>
		</view>
		<view class="imgContent"> 
			<view class="tit" >
				<image :src="notices_info.imgUrl" style="width: 100%; "></image>
			</view>
		</view>
		<!-- 回到顶部 -->
		<view class="wrap">
			<u-back-top :scroll-top="scrollTop"></u-back-top>
		</view>
	</view>
</template>

<script>
	export default {
		//过滤时间
		filters: {
			formatDate(date) {
				const nDate = new Date(date)
				const year = nDate.getFullYear()
				const month = nDate.getMonth().toString().padStart(2, 0)
				const day = nDate.getDate().toString().padStart(2, 0)
				return year + '-' + month + '-' + day
			}
		},
		data() {
			return {
				id: 0, 
				// 回到顶部样式
				scrollTop: 0,
				mode: "square",
				iconStyle: {
					fontSize: "32rpx",
					color: "#2979ff",
				},
				notices_info: {},
				article_content: ''

			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetailList()
			console.log(options);
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		methods: { 
			//获取文章详情 
			getDetailList() {
				const that = this
				that.$api.request('article', 'noticePage', {
					articleId: that.id,
				}).then(res => {
					that.article_info = res.data.items
					for (let i = 0; i < that.article_info.length; i++) {
						if(that.id == that.article_info[i].id){
							that.notices_info=that.article_info[i]
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.imgContent {
		padding: 0 30rpx;

		.tit {
			line-height: 1.7;
			margin-bottom: 30rpx;
		}


	}

	.news_item {
		padding: 10rpx 10rpx;
		.newsTitle {
			font-size: 35rpx;
			line-height: 1.5;
			display: flex;
			justify-content: space-around;
			padding: 0 30rpx;
			font-weight: bolder;
		}

		.info {
			font-size: 20rpx;
			justify-content: space-between;
			display: flex;
			padding: 30rpx;
			color: #999999;
			text:nth-child(2) {
				margin-left: 30rpx;
			}
		}
	}
</style>
